# Combo example: converts all .jpg files to .djvu and puts them into a new bundle called pictures-bundle.djvu
# First convert all the .jpgs to djvus.  -decibel 47 is one short of the maximum quality of 48
echo "Converting all the .jpgs to djvus."
for i in `ls *.jpg *.JPG`; do c44 -decibel 16,32,40,47 -slice 2,12,72,83,93,103 -bpp  0.001,0.01,0.02,0.10,0.25,0.5,1 $i; done 
# Move all the .jpgs to a backup directory to delete later
echo "Moving all the jpegs to a backup directory"
mkdir backup-to-delete-if-successful/
mv *.jpg backup-to-delete-if-successful/
mv *.JPG backup-to-delete-if-successful/
echo "Creating a bundled djvu"
# Create a direct bundled djvu
for i in `ls *.djvu` ; do pagelist="$pagelist $i" ; done ; djvm -c pictures-bundle.djvu-temp $pagelist
# Move all the individual djvus to the backup directory
echo "Clearing the intermediate djvus into the backup directory to delete later"
mv *.djvu backup-to-delete-if-successful/
# Convert the direct bundle to an indirect bundle in the current directory
echo "Creating the indirect bundle of pictures"
djvmcvt -i pictures-bundle.djvu-temp . pictures-bundle-index.djvu
echo "Viewing the result."
djview pictures-bundle-index.djvu
# Delete temporary files
# rm pictures-bundle.djvu-temp
# rm -rv backup-to-delete-if-successful/

